/**
 * ZipKinTest1Application.java
 * com.lyj.zipkin.test.one
 * Function： TODO add descript
 *
 *   ver     date      		author
 * ──────────────────────────────────
 *   		 2017年9月14日       lyj
 *
 * Copyright (c) 2017, TNT All Rights Reserved.
*/

package com.lyj.zipkin.test.two;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.sleuth.sampler.AlwaysSampler;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * ClassName:ZipKinTest1Application
 * Function: TODO ADD FUNCTION
 * Reason:	 TODO ADD REASON
 *
 * @author   lyj
 * @version  
 * @since    version 1.0
 * @Date	 2017年9月14日	下午5:59:28
 *
 * @see 	 
 *  
 */
@SpringBootApplication
@EnableDiscoveryClient
@RestController
public class ZipKinTest2Application {

    @Bean
    public AlwaysSampler defaultSampler(){
        return new AlwaysSampler();
    }
    
    @Autowired
    private RestTemplate restTemplate;

    @Bean
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
    
    
    @RequestMapping("/hello")
    public String callHome(){
        return restTemplate.getForObject("http://localhost:9991/test", String.class);
    }
    
    @RequestMapping("/test")
    public String info(){

        return "zipkin test 02";

    }
    
    public static void main(String[] args) {
        SpringApplication.run(ZipKinTest2Application.class, args);
    }
	
}
